package com.rui.study.algorithm.P_回文数;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2019-01-08 09:42
 **/
public class Solution {
    public boolean isPalindrome(int x) {
        if (x < 0) return false;
        int origin = x;
        int reversion = 0;
        while (x > 0) {
            int tmp = x % 10;
            x = x / 10;
            reversion = reversion * 10 + tmp;
        }
        if (reversion == origin) return true;
        return false;
    }

    public static void main(String[] args) {
        long begin = System.currentTimeMillis();
        Solution solution = new Solution();
        boolean result = solution.isPalindrome(1134554311);
        long end = System.currentTimeMillis();
        System.out.println("回文数：" + result + ", 耗时：[" + (end - begin) + "ms]");
    }
}
